<script src="<?php echo base_url() ?>commons/validacion/js/jquery-1.8.2.min.js" type="text/javascript"></script>
<link href="<?php echo base_url() ?>commons/validacion/css/validationEngine.jquery.css" rel="stylesheet">
<script src="<?php echo base_url() ?>commons/validacion/js/languages/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
<script src="<?php echo base_url() ?>commons/validacion/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>

<link rel="stylesheet" href="<? echo base_url() ?>commons/jquery/themes/base/jquery.ui.all.css">
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.core.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.widget.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.tabs.js"></script>

<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.core.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.widget.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.mouse.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.draggable.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.position.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.resizable.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.button.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.dialog.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.effect.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.effect-blind.js"></script>
<script src="<?php echo base_url() ?>commons/jquery/ui/jquery.ui.effect-explode.js"></script>

<script>
    var t1 = jQuery.noConflict();
    t1(document).ready(function() {
        // binds form submission and fields to the validation engine			
        t1("#formID").validationEngine();
        // alert('sss');
    });

    /**
     *
     * @param {jqObject} the field where the validation applies
     * @param {Array[String]} validation rules for this field
     * @param {int} rule index
     * @param {Map} form options
     * @return an error string if validation failed
     */
    function checkHELLO(field, rules, i, options) {
        if (field.val() != "HELLO") {
            // this allows to use i18 for the error msgs
            return options.allrules.validate2fields.alertText;
        }
    }
</script>


<script>
</script>


<form class="well form-horizontal span8" action="<?php echo base_url() . "admin.php/asigna_arrastre/modificadatos" ?>" method="post" enctype="multipart/form-data" >
    <legend>PROCESAR DATOS DE LA MATRICULA</legend>

    <div class="tabbable">
        <ul class="nav nav-tabs">
            <li><a href="#1" data-toggle="tab">Datos Generales</a></li>
            <li class="active"><a href="#2" data-toggle="tab">Datos Matr&iacute;cula</a></li>
        </ul>
        <div class="tab-content">
            <?php foreach ($estudiante as $i => $est) { ?>
                <div class="tab-pane " id="1">
                    <div class="control-group">
                        <label class="control-label" for="input01">N&uacute;mero de Identificaci&oacute;</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="cedula_pers" value= "<?php echo $est['cedula_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="select01">Tipo de Documento</label>
                        <div class="controls">

                            <select id="select01"  name="tipo_doc_pers">

                                <option value= "0" <?php echo ($est['tipo_doc_pers'] == 0 ? " selected" : " "); ?>>CEDULA</option>
                                <option value= "1" <?php echo ($est['tipo_doc_pers'] == 1 ? " selected" : " "); ?>>PASAPORTE</option>
                                <option value= "2" <?php echo ($est['tipo_doc_pers'] == 2 ? " selected" : " "); ?>>CARNE DE REFUGIADO</option>
                            </select>

                        </div>
                    </div>


                    <div class="control-group">
                        <label class="control-label" for="input02">Nombre Completos</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="nombre_pers" value= "<?php echo $est['nombre_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input03">Apellidos </label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="apellido_pers" value= "<?php echo $est['apellido_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input04">Nacionalidad </label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="nacionalidad_pers" value= "<?php echo $est['nacionalidad_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input15">Provincia </label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="provincia_pers" value= "<?php echo $est['provincia_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input05">Ciudad </label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="ciudad_pers" value= "<?php echo $est['ciudad_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input06">Direccion del Domicilio</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="direccion_pers" value= "<?php echo $est['direccion_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input07">Referencia del Domicilio</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="refer_domic_pers" value= "<?php echo $est['refer_domic_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input08">Tipo de Discapacidad</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="tipo_discap_pers" value= "<?php echo $est['tipo_discap_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input09">Carn&eacute; del CONADIS</label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="conadis_pers" value= "<?php echo $est['conadis_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input010">Porcentaje de Discapacidad</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="porc_disc_pers" value= "<?php echo $est['porc_disc_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="select01">Sexo</label>
                        <div class="controls">

                            <select id="select01"  name="sexo_pers">
                                <option <?php echo ($est['sexo_pers'] == "HOMBRE" ? " selected" : " "); ?>>HOMBRE</option>
                                <option <?php echo ($est['sexo_pers'] == "MUJER" ? " selected" : " "); ?>>MUJER</option>
                            </select>

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="select02">Estado Civil</label>
                        <div class="controls">

                            <select id="select02"  name="estado_civil_pers">
                                <option <?php echo ($est['estado_civil_pers'] == "SOLTERO(A)" ? " selected" : " "); ?>>SOLTERO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "CASADO(A)" ? " selected" : " "); ?>>CASADO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "UNION LIBRE" ? " selected" : " "); ?>>UNION LIBRE</option>
                                <option <?php echo ($est['estado_civil_pers'] == "DIVORCIADO(A)" ? " selected" : " "); ?>>DIVORCIADO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "VIUDO(A)" ? " selected" : " "); ?>>VIUDO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "ECLECIASTICO(A)" ? " selected" : " "); ?>>ECLECIASTICO(A)</option>


                            </select>

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="select12">Autodefinici&oacute;</label>
                        <div class="controls">

                            <select id="select02"  name="autodefin_pers">
                                <option <?php echo ($est['autodefin_pers'] == "NEGRO" ? " selected" : " "); ?>>NEGRO</option>
                                <option <?php echo ($est['autodefin_pers'] == "MULATO" ? " selected" : " "); ?>>MULATO</option>
                                <option <?php echo ($est['autodefin_pers'] == "AFROECUATORIANO" ? " selected" : " "); ?>>AFROECUATORIANO</option>
                                <option <?php echo ($est['autodefin_pers'] == "INDIGENA" ? " selected" : " "); ?>>INDIGENA</option>
                                <option <?php echo ($est['autodefin_pers'] == "MESTIZO" ? " selected" : " "); ?>>MESTIZO</option>
                                <option <?php echo ($est['autodefin_pers'] == "MONTUBIO" ? " selected" : " "); ?>>MONTUBIO</option>
                                <option <?php echo ($est['autodefin_pers'] == "BLANCO" ? " selected" : " "); ?>>BLANCO</option>
                                <option <?php echo ($est['autodefin_pers'] == "OTRO" ? " selected" : " "); ?>>OTRO</option>


                            </select>

                        </div>
                    </div>


                    <div class="control-group">
                        <label class="control-label" for="select03">Fecha de Nacimiento</label>
                        <div class="controls">
                            <input type="text" class="input-medium "  id="datepicker" name="fecha_nac_pers" value="<?php echo date("m/d/Y", strtotime($est['fecha_nac_pers'])); ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input08">N&uacute;mero de tel&eacute;fono</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="fono_pers" value= "<?php echo $est['fono_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input09">N&uacute;mero de celular</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="celular_pers" value= "<?php echo $est['celular_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input10">Correo Electr&oacute;nico Institucional</label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="email_inst_pers" value= "<?php echo $est['email_inst_pers']; ?>">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input11">Fotograf&iacute;a</label>
                        <div class="controls">
                            <img src="<?php echo $est['foto_pers']; ?>" width="88" height="99" alt="itss1"/>
                        </div>
                    </div>

 

                </div>
               

            <?php } ?>
            <div class="tab-pane active" id="2">
                <div class="control-group">
                    <label class="control-label" for="select01">PERIODO</label>
                    <div class="controls ">
                        <select name="ide_lec_nom" class="span3">
                            <option ><?php echo $ide_lec_nom; ?></option>
                        </select>

                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="select03">CARRERA</label>
                    <div class="controls ">
                        <select name="ide_car_nom" class="span3" >
                            <option ><?php echo $ide_car_nom; ?></option>
                        </select>

                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="select03">Pensums</label>
                    <div class="controls ">
                        <select id="select02" name="ide_pen1" class="span3">
                            <option ><?php echo $ide_pen_nom; ?></option>
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="select04">Ciclo</label>
                    <div class="controls ">
                        <select id="select02" name="ide_ciclo_nom" class="span3">

                            <option ><?php echo $ide_ciclo_nom; ?></option>
                        </select>
                    </div>
                </div>

                    <div class="control-group">
                        <label class="control-label" for="input11">MODO DE MATRICULA</label>
                        <div class="controls">
                            <select id="tipo_matr" name="modo_mat" class="span2" readonly="true">
                                <option value="1" <?php echo ($modo_mat == 1 ? " selected" : " "); ?>>NORMAL</option>
                                <option value="2" <?php echo ($modo_mat == 2 ? " selected" : " "); ?>>NORMAL/ARRASTRE</option>
                                <option value="3" <?php echo ($modo_mat == 3 ? " selected" : " "); ?>>CONVALIDACION</option>
                                <option value="4" <?php echo ($modo_mat == 4 ? " selected" : " "); ?>>ARRASTRES</option>
                                <option value="5" <?php echo ($modo_mat == 5 ? " selected" : " "); ?>>POR MATERIAS</option>


                            </select>


                        </div>
                    </div>   

                <div class="control-group">
                    <label class="control-label" for="select02">JORNADA DE TRABAJO</label>
                    <div class="controls ">
    
                        <select name="seccion1" id="secc" class="span2">
                                <option value="1" <?php echo ($seccion_nom == "DIURNO" ? " selected" : " "); ?>>DIURNO</option>
                                <option value="2" <?php echo ($seccion_nom == "NOCTURNO" ? " selected" : " "); ?>>NOCTURNO</option>
                                <option value="3" <?php echo ($seccion_nom == "FINES DE SEMANA" ? " selected" : " "); ?>>FINES DE SEMANA</option>
                        </select>


                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="select02">PARALELO</label>
                    <div class="controls ">
                        <select name="paralelo1" id="paral" class="span1">
                                <option <?php echo ($paralelo_nom == "A" ? " selected" : " "); ?>>A</option>
                                <option <?php echo ($paralelo_nom == "B" ? " selected" : " "); ?>>B</option>
                                <option <?php echo ($paralelo_nom == "C" ? " selected" : " "); ?>>C</option>
                            
                          
                        </select>
                        <!--<input class="btn" type="button" onclick="mostrar_cambio()" value="Cambiar">                
document.getElementById('<?php echo ("couta" . $i . "_plans"); ?>') -->

                        

                    </div>
                </div>

 
                <div id="tablamatriculai" >
                    <table class="table table-bordered table-striped table-condensed">
                        <thead>
                            <tr>
                                <th>ASIGNA</th>
                                <th>COD</th>
                                <th>MATERIA</th>
                                <th>REGISTRADO</th>
                                <th>REASIGNADA</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            if ($cambio==0){
                            $nro_filas = 0;
                            if (!empty($materias)) {
                                $nro_filas = count($materias);
                                
                                
                                foreach ($materias as $i => $mat) {
                                      if ($mat['estado_cur'] == 4 OR $mat['estado_cur'] == 5 OR $mat['estado_cur'] == 6) {
                                         $reasigna = array('ide_per' => $ide_lec, 'id_matr' => $id_matr,
                                                         'ide_mat' => $mat['ide_mat']);
                                             
                                         $datos_c=$this->Cursa_Model->getCursa_estudiante($reasigna);           

                                          

                                    ?>
                                    <tr>

                                        <td ><div centrar align="center"><i class="icon-ok"></i>
                                                <input type="hidden" <?php echo "name='ide_mat" . $i . "' value='" . $mat['ide_mat'] . "'"; ?>>
                                            </div></td>

                                        <td><?php echo ($mat['codigo_cic'] . "." . $mat['codigo_mat']) ?></td>
                                        <td>
                                      <?php if ($datos_c[0]['reasig_arrastre_cur']==0){ //$cursa[0]['ide_cur']?>
                                            <a data-toggle="modal" href="<?php echo base_url() . "admin.php/asigna_arrastre/modificadatos/$ide_lec/$id_matr/".$mat['ide_mat'] ?>" class="btn btn-primary"><?php echo $mat['nombre_mat'] ?></a>
                                      <?php }else{
                                              echo $mat['nombre_mat'];
                                                         

                                              
                                      }?>

                                        </td>

                                        <td >
                                             <select multiple="multiple" id="multiSelect">
                                            <!--<select id="select01"  <?php echo "name='ide_doc" . $i . "'"; ?> class="span2">-->
                                                 <option><?php echo $ide_car_nom; ?></option>
                                                 <option><?php echo $ide_ciclo_nom; ?></option>
                                                 <option><?php echo $seccion_nom ." ".$paralelo_nom; ?></option>
                                                <?php
                                                $docentes = $this->Docente_Model->getDatosDocente($mat['ide_pers']);
                                                //print_r($docentes);

                                                foreach ($docentes as $k => $doc) {
                                                    echo ("<option value='" . $doc["ide_doc"] . "'>");
                                                    echo ($doc["apellido_pers"] . " " . $doc["nombre_pers"] . "</option>");
                                                }
                                                ?>

                                            </select> 


                                        </td>   
                                        <td>
                                      <?php if ($datos_c[0]['reasig_arrastre_cur']==0){ //$cursa[0]['ide_cur']?>
                                             <select multiple="multiple" id="multiSelect" name="datos_a">
                                                 <option>NO ASIGNADO</option>

                                            </select> 
                                      <?php }else{
                                          $datos_a=$this->Cursa_Model->getDescripcionArrastre($datos_c[0]['ide_cur']);
                                          ?>
                                          
                                             <select multiple="multiple" id="multiSelect" name="datos_a">
                                            <!--<select id="select01"  <?php echo "name='ide_doc" . $i . "'"; ?> class="span2">-->
                                                 <option><?php echo $datos_a[0]['nombre_car']; ?></option>
                                                 <option><?php echo $datos_a[0]['nombre_cic']; ?></option>
                                                 
                                                 <option><?php echo (($datos_a[0]['seccion_arr'] == 1 ? "DIURNO" : ($datos_a[0]['seccion_arr'] == 2 ? "NOCTURNO" : "FIN DE SEMANA"))
                                                         ." ".$datos_a[0]['paralelo_arr']); ?></option>
                                                 <option><?php echo $datos_a[0]['nombre_mat']; ?></option>
                                                 <option><?php echo $datos_a[0]['apellido_pers'] ." ".$datos_a[0]['nombre_pers']; ?></option>

                                            </select> 
                                            <a href="<?php echo base_url() . "admin.php/asigna_arrastre/eliminadatos/".$datos_a[0]['ide_arr']."/".$datos_c[0]['ide_cur']."/".$id_matr ?>" onclick="return confirm('Desea Eliminar?')"><i class=' icon-remove-circle'></i></a>
                                          
                                          

                                              
                                      <?php }?>
                                            
                                        </td>
                                    </tr>
                                    <?php
                                }
                                }
                                }
                            }
                            ?>
                                    
                        </tbody>
                    </table>        
                </div>     




            </div>  <!--fin tabulador 3 -->
        </div>
    </div>

    <?php if (isset($msj_error)) { ?>
        <div class='MensajeError'>
            <?php echo ($msj_error); ?>
        </div>
    <?php } ?>
   <div class="controls">
   <!--     <button type="submit" class="btn">Modificar Matricula</button>
-->

        <a href="<?php echo base_url() . "admin.php/asigna_arrastre/inicio/$ide_lec" ?>">
            <img src="<?php echo base_url(); ?>commons/images/boton_volver.gif"></a>

    </div>   
    <fieldset>
        <div class="control-group"> 
            <div class="controls">
                <input type="hidden" name="nro_filas" value="<?php echo $nro_filas; ?>">
                <input type="hidden" name="ide_lec" value="<?php echo $ide_lec; ?>">
                <input type="hidden" name="ide_car" value="<?php echo $ide_car; ?>">
                <input type="hidden" name="ide_pen" value="<?php echo $ide_pen; ?>">
                <input type="hidden" name="ide_est" value="<?php echo $est["ide_est"]; ?>">
                <input type="hidden" name="cupo_cur" value="<?php echo $nro_cup; ?>">
                <input type="hidden" name="id_matr" value="<?php echo $id_matr; ?>">
                

                <input type="hidden" name="cambio" value="<?php echo $cambio; ?>">
               <!-- <input type="hidden" name="modo_mat" value="<?php echo $inscrito[0]['modo_mat']; ?>"--> 

            </div>
        </div >
    </fieldset>

    <fieldset>








</form>


